package com.kehutong.house.dao;

import org.coraframework.orm.annotation.Dao;
import org.coraframework.orm.annotation.Mapper;
import org.coraframework.orm.jdbc.Page;
import org.coraframework.orm.jdbc.execute.Condition;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Dao
public interface ParkingDao {

	@Mapper(
			genericType = HashMap.class,
			countSQL ="select count(1) from t_parking p LEFT JOIN t_parking_yard b ON b.id = p.yardNo AND p.deleted = false where ${}",
			sql="select p.id, p.communityNo," +
					"p.communityName," +
					"p.classNo," +
					"p.name," +
					"p.yardNo," +
					"p.enable," +
					"p.ownerNo," +
					"p.ownerName," +
					"p.ownerMobile," +
					"p.ownerCarNo," +
					"p.salesStatus," +
					"p.deleted," +
					"b.employeeNos from t_parking p LEFT JOIN t_parking_yard b ON b.id = p.yardNo AND p.deleted = false where ${}"
	)
	public Page<Map<String, Object>> loadPage(Condition...condition);

	@Mapper(
			genericType = HashMap.class,
			sql="select p.id, p.communityNo," +
					"p.communityName," +
					"p.yardNo," +
					"p.enable," +
					"p.name," +
					"p.ownerNo," +
					"p.ownerName," +
					"p.classNo," +
					"p.ownerMobile," +
					"p.ownerCarNo," +
					"p.salesStatus," +
					"p.deleted," +
					"b.employeeNos from t_parking p LEFT JOIN t_parking_yard b ON b.id = p.yardNo AND p.deleted = false where ${}"
	)
	public List<Map<String, Object>> loadList(Condition...condition);
}
